
const { getPrivateKey } = require('./rsaControl')

module.exports = {
    async createToken(userInfo) {   //生成token
        let { username, _id } = userInfo


        let privateKey = await getPrivateKey()
        let token = jwt.sign({ username, _id, exp: ~~((Date.now() / 1000) + 24 * 3600 * 3) }, privateKey, { algorithm: 'RS256' });  //生成token
        return token
    }
}